Table Effects
Functions to generate effects.
Functions
Tables
ParticleData | Structure for EmitAdvancedParticle table. |
Functions
- EmitLightningArc(origin, target, color, life, amplitude, beamWidth, detail, smooth, endDrift)
-
Emit a lightning arc.
Parameters:
- origin Vec3
- target Vec3
- color Color (default Color(255, 255, 255))
- life float Lifetime in seconds. Clamped to [0, 4.233] for now because of strange internal maths. default: 1
- amplitude int "strength" of the lightning - the higher the value, the "taller" the arcs. Clamped to [1, 255]. default: 20
- beamWidth int Clamped to [1, 127]. default 2
- detail int Higher numbers equal more segments, but it's not a 1:1 correlation. Clamped to [1, 127]. default: 10
- smooth bool If true, the arc will have large, smooth curves; if false, it will have small, jagged spikes. default: false
- endDrift bool If true, the end of the arc will be able to gradually drift away from its destination in a random direction default: false
- EmitParticle(pos, vel, spriteID, gravity, rotVel, startColor, endColor, blendMode, startSize, endSize, life, damage, poison, spriteSeqID, startRot)
-
Emit a particle.
Parameters:
- pos Vec3 World position.
- vel Vec3 Directional velocity.
- spriteID int Sprite ID in the sprite sequence slot.
- gravity float Effect of gravity. Positive value ascends, negative value descends. default: 0
- rotVel float Rotational velocity in degrees. default: 0
- startColor Color Color at start of life. default: Color(255, 255, 255)
- endColor Color Color at end of life. This will finish long before the end of the particle's life due to internal math. default: Color(255, 255, 255)
- blendMode BlendID Render blend mode. TEN.Effects.BlendID.ALPHA_BLEND
- startSize float Size at start of life. default: 10
- endSize float Size at end of life. default: 0
- life float Lifespan in seconds. default: 2
- damage bool Harm the player on collision. default: false
- poison bool Poison the player on collision. default: false
- spriteSeqID SpriteConstants Sprite sequence slot ID. default: Objects.ObjID.DEFAULT_SPRITES
- startRot float Rotation at start of life. default: random
Usage:
EmitParticle( pos, Vec3(math.random(), math.random(), math.random()), 22, -- spriteID 0, -- gravity -2, -- rotVel Color(255, 0, 0), -- startColor Color(0, 255, 0), -- endColor TEN.Effects.BlendID.ADDITIVE, -- blendMode 15, -- startSize 50, -- endSize 20, -- life false, -- damage true, -- poison Objects.ObjID.DEFAULT_SPRITES, -- spriteSeqID 180) -- startRot
- EmitAdvancedParticle(ParticleData)
-
Emit a particle with extensive configuration options, including sprite sequence animation, lights, sounds, and damage effects.
Parameters:
- ParticleData ParticleData Table containing particle data.
Usage:
local particle = { pos = GetMoveableByName("camera_target_6"):GetPosition(), vel = Vec3(0, 0, 10), spriteSeqID = TEN.Objects.ObjID.CUSTOM_BAR_GRAPHIC, spriteID = 0, life = 10, maxYVel = 0, gravity = 0, friction = 10, startRot = 0, rotVel = 0, startSize = 80, endSize = 80, startColor = TEN.Color(128, 128, 128), endColor = TEN.Color(128, 128, 128), blendMode = TEN.Effects.BlendID.ADDITIVE, wind = false, damage = true, poison = false, burn = false, damageHit = 80, soundID = 197, light = true, lightRadius = 6, lightFlicker = 5, animated = true, frameRate = 0.25, animType = TEN.Effects.ParticleAnimationType.LOOP, } EmitAdvancedParticle(particle)
- EmitShockwave(pos, innerRadius, outerRadius, color, lifetime, speed, angle, hurtsLara)
-
Emit a shockwave, similar to that seen when a harpy projectile hits something.
Parameters:
- pos Vec3 Origin position
- innerRadius int (default 0) Initial inner radius of the shockwave circle - 128 will be approx a click, 512 approx a block
- outerRadius int (default 128) Initial outer radius of the shockwave circle
- color Color (default Color(255, 255, 255))
- lifetime float (default 1.0) Lifetime in seconds (max 8.5 because of inner maths weirdness)
- speed int (default 50) Initial speed of the shockwave's expansion (the shockwave will always slow as it goes)
- angle int (default 0) Angle about the X axis - a value of 90 will cause the shockwave to be entirely vertical
- hurtsLara bool (default false) If true, the shockwave will hurt Lara, with the damage being relative to the shockwave's current speed
- EmitLight(pos[, color][, radius][, shadows][, name])
-
Emit dynamic light that lasts for a single frame.
If you want a light that sticks around, you must call this each frame.
Parameters:
- pos Vec3 position of the light
- color Color light color (default Color(255, 255, 255)) (optional)
- radius int measured in "clicks" or 256 world units (default 20) (optional)
- shadows bool determines whether light should generate dynamic shadows for applicable moveables (default is false) (optional)
- name string if provided, engine will interpolate this light for high framerate mode (be careful not to use same name for different lights) (optional)
- EmitSpotLight(pos, dir[, color][, radius][, falloff][, distance][, shadows][, name])
-
Emit dynamic directional spotlight that lasts for a single frame.
If you want a light that sticks around, you must call this each frame.
Parameters:
- pos Vec3 position of the light
- dir Vec3 normal which indicates light direction
- color Color (default Color(255, 255, 255)) (optional)
- radius int overall radius at the endpoint of a light cone, measured in "clicks" or 256 world units (default 10) (optional)
- falloff int radius, at which light starts to fade out, measured in "clicks" (default 5) (optional)
- distance int distance, at which light cone fades out, measured in "clicks" (default 20) (optional)
- shadows bool determines whether light should generate dynamic shadows for applicable moveables (default is false) (optional)
- name string if provided, engine will interpolate this light for high framerate mode (be careful not to use same name for different lights) (optional)
- EmitBlood(pos, count)
-
Emit blood.
Parameters:
- pos Vec3
- count int Sprite count. default: 1
- EmitAirBubble(pos[, size][, amp])
-
Emit an air bubble in a water room.
Parameters:
- pos Vec3 World position where the effect will be spawned. Must be in a water room.
- size float Sprite size. Default: 32 (optional)
- amp float Oscillation amplitude. Default: 32 (optional)
- EmitFire(pos, size)
-
Emit fire for one frame. Will not hurt player. Call this each frame if you want a continuous fire.
Parameters:
- pos Vec3
- size float Fire size. default: 1
- MakeExplosion(pos, size, shockwave)
-
Make an explosion. Does not hurt Lara
Parameters:
- pos Vec3
- size float (default 512.0) this will not be the size of the sprites, but rather the distance between the origin and any additional sprites
- shockwave bool (default false) if true, create a very faint white shockwave which will not hurt Lara
- MakeEarthquake(strength)
-
Make an earthquake
Parameters:
- strength int (default 100) How strong should the earthquake be? Increasing this value also increases the lifespan of the earthquake.
- GetWind()
-
Get the wind vector for the current game frame.
This represents the 3D displacement applied by the engine on things like particles affected by wind.()
Returns:
-
Vec3
Wind vector.
- EmitStreamer(mov, tag, pos, dir[, rot][, startColor][, endColor][, width][, life][, vel][, expRate][, rotRate][, edgeFeatherMode][, lengthFeatherMode][, blendID])
-
Emit an extending streamer effect.
Parameters:
- mov Moveable Moveable object with which to associate the effect.
- tag int[opt] Numeric tag with which to associate the effect on the moveable. Default: 0
- pos Vec3 World position.
- dir Vec3 Direction vector of movement velocity.
- rot float Start rotation in degrees. Default: 0 (optional)
- startColor Color Color at the start of life. Default: Color(255, 255, 255, 255)) (optional)
- endColor Color Color at the end of life. Default: Color(0, 0, 0, 0)) (optional)
- width float Width in world units. Default: 0 (optional)
- life float Lifetime in seconds. Default: 1 (optional)
- vel float Movement velocity in world units per second. Default: 0 (optional)
- expRate float Width expansion rate in world units per second. Default: 0 (optional)
- rotRate float Rotation rate in degrees per second. Default: 0 (optional)
- edgeFeatherMode StreamerFeatherMode Edge feather mode. Default: Effects.StreamerFeatherMode.NONE (optional)
- lengthFeatherMode StreamerFeatherMode Length feather mode. UNIMPLEMENTED, currently will always leave a fading tail (optional)
- blendID BlendID Renderer blend ID. Default: Effects.BlendID.ALPHA_BLEND (optional)
Tables
- ParticleData
-
Structure for EmitAdvancedParticle table.
Fields:
- pos Vec3 World position.
- vel Vec3 Directional velocity in world units per second.
- spriteSeqID SpriteConstants Sprite sequence slot ID. default: Objects.ObjID.DEFAULT_SPRITES (optional)
- spriteID int Sprite ID in the sprite sequence slot. default: 0 (optional)
- life float Lifespan in seconds. default: 2 (optional)
- maxYVel float Maximum vertical velocity in world units per second. default: 0 (optional)
- gravity float Effect of gravity in world units per second. Positive value ascend, negative value descend. default: 0 (optional)
- friction float Friction affecting velocity over time in world units per second. default: 0 (optional)
- startRot float Rotation at start of life. default: random (optional)
- rotVel float Rotational velocity in degrees per second. default: 0 (optional)
- startSize float Size at start of life. default: 10 (optional)
- endSize float Size at end of life. default: 0 (optional)
- startColor Color Color at start of life. default: Color(255, 255, 255) (optional)
- endColor Color Color at end of life. Note that this will finish long before the end of life due to internal math. default: Color(255, 255, 255) (optional)
- blendMode BlendID Render blend mode. default: TEN.Effects.BlendID.ALPHA_BLEND (optional)
- damage bool Harm the player on collision. default: false (optional)
- poison bool Poison the player on collision. default: false (optional)
- burn bool Burn the player on collision. default: false (optional)
- wind bool Affect position by wind in outside rooms. default: false (optional)
- damageHit int Player damage amount on collision. default: 2 (optional)
- light bool Emit a colored light. CAUTION: Recommended only for a single particle. Too many particles with lights can overwhelm the lighting system. default: false (optional)
- lightRadius int Light radius in 1/4 blocks. default: 0 (optional)
- lightFlicker int Interval at which the light should flicker. default: 0 (optional)
- soundID int Sound ID to play. CAUTION: Recommended only for a single particle. Too many particles with sounds can overwhelm the sound system. default: none (optional)
- animated bool Play animates sprite sequence. default: false (optional)
- animType ParticleAnimationType Animation type of the sprite sequence. default: TEN.Effects.ParticleAnimationType.LOOP (optional)
- frameRate float Sprite sequence animation framerate. default: 1 (optional)